<?php
	$m = new Mongo();
	$db = $m->EMU;
	$collection = $db->requests;
	$subDate = date("m/d/Y"); //Current date.
	$newticket = 0;
	$ticketNum = 0;
	
	
	
	
	// Ensures the schedules date cannot be earlier than the present date, and
	// that the description is filled in.
	if (($_POST['schedDate'] <= $subDate) && ($_POST['schedDate']))
	{
		Header("Location: ../editRequest.php?error=modDate&requestnum=".$_POST['ticketNum']);
		exit();
	}
	/*elseif (($_POST['schedDate'] <= $subDate) && (!$_POST['schedDate']))
	{
		Header("Location: ../requests.php?error=emptyEquip1");
		exit();
	}
	elseif (($_POST['schedDate'] > $subDate) && (!$_POST['schedDate']))
	{
		Header("Location: ../requests.php?error=emptyEquip2");
		exit();
	}*/
	
	
	// Inserts new values into MongoDB results ... document? Page? Collection? Bag of mystery?
		$collection->update(array("ticketNum"=> (int)$_POST['ticketNum']),array('ticketNum' => (int)$_POST['ticketNum'], 'assignee' => $_POST['assignee'], 'requester' => $_POST['requester'], 'mDescription' => $_POST['mDescription'], 'subDate' => $_POST['subDate'], 'schedDate' => $_POST['schedDate'], 'status' => $_POST['status']));
		Header("Location: ../requests.php");
	
?>